// 导入token工具包
import { GetToken, DelToken, GetUserInfo, DelUserInfo } from '@/utils/storage'
const state = {
  token: GetToken() || '',
  userInfo: GetUserInfo() || ''
}
const getters = {
}
const mutations = {
  // 接收登录后并设置token
  NewSetToken (state, NewToken) {
    state.token = NewToken
  },
  // 退出功能
  LogOut (state) {
    DelToken()
    DelUserInfo()
    state.token = ''
  },
  // 接收用户资料信息
  setUserInfo (state, NewUserInfo) {
    state.userInfo = NewUserInfo
  }
}
const actions = {
}
export default {
  // 开启命名空间
  namespaced: true,
  state,
  getters,
  mutations,
  actions
}
